﻿<BadHabit_WPFTools:ShapedWindow
    
    x:Class="BadHabit.Factory.Windows.TeamMemberManager"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:BadHabit_WPFTools="clr-namespace:BadHabit.WPFTools;assembly=BadHabit.WPFTools"        
    xmlns:BadHabit_Factory_Controls="clr-namespace:BadHabit.Factory.Controls"  
    xmlns:Microsoft_Toolkit="http://schemas.microsoft.com/wpf/2008/toolkit"
    
    xmlns:props="clr-namespace:BadHabit.Factory.Properties"
    
    Style="{StaticResource DialogEditWindow}"
    
    ShowInTaskbar="True"
    Icon="/Images/WindowsIcons/Factory.ico"
    
    Topmost="True"
    
    WindowStartupLocation="CenterScreen"
    SnapsToDevicePixels="True"
    
    Title="{x:Static props:Resources.Team_Members}"
    
    Loaded="TeamMemberManager_Loaded"
    
    DataContext="{Binding DefaultView}"
    
    SizeToContent="WidthAndHeight"
    
    MinHeight="400"
    
    MaxHeight="650"
  
    >
    
    <BadHabit_WPFTools:ShapedWindow.CommandBindings>
        <CommandBinding Command="ApplicationCommands.Undo" Executed="Undo_Executed"/>
        <CommandBinding Command="ApplicationCommands.Save" Executed="Save_Executed"/>
    </BadHabit_WPFTools:ShapedWindow.CommandBindings>
    
    <BadHabit_WPFTools:ShapedWindow.Resources>
        
      
        
    </BadHabit_WPFTools:ShapedWindow.Resources>

    <Grid Background="{StaticResource GradientSilverTubeBrush}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <ToolBar x:Name="ToolBar" Grid.Row="0" Grid.Column="0" ToolBarTray.IsLocked="True">
            
            <TextBlock VerticalAlignment="Center" Style="{StaticResource Label}" Text="{x:Static props:Resources.Search}"/>
            <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                <BadHabit_WPFTools:ComboBox                        
                           x:Name="clientComboBox"
                            SelectionChanged="clientComboBox_SelectionChanged"
                            Width="200"
                            VerticalAlignment="Center"
                          ItemsSource="{Binding Source={StaticResource ClientList}}"
                            Style="{StaticResource FormComboBox}"/>

                <TextBox x:Name="searchTextBox" Width="200"
                         VerticalAlignment="Center"
                         Style="{StaticResource FilterTextBox}" SelectionChanged="searchTextBox_SelectionChanged"  />            
            </StackPanel>
            
            <Menu>
                <MenuItem
                x:Name="addMemberButton"     
                     Style="{StaticResource ToolBarMenuItem}"
                BadHabit_WPFTools:RoleChecker.RequiredVisibleRole="FACTORY_OWNER"
                Click="addMemberButton_Click"
                Header="{x:Static props:Resources.New}">
                    <MenuItem.Icon>
                        <Image Source="/Images/Toolbar/TeamMember.png"  Stretch="Uniform" Width="32" Height="32"/>
                    </MenuItem.Icon>
                </MenuItem>
            </Menu>
            
            
        </ToolBar>
        
        <ListBox Grid.Column="0" Grid.Row="1"    
                Name="teamMemberListBox"
                HorizontalAlignment="Stretch"             
                 
                 
                 
                 
                HorizontalContentAlignment="Stretch"
                VerticalContentAlignment="Stretch"     
                Background="Transparent"                                            
                BorderThickness="0,0,0,0"                                    
                IsSynchronizedWithCurrentItem="True"
                 
                ItemsSource="{Binding IsAsync=True}"
                 
                ItemTemplate="{StaticResource TeamMemberTemplate}"
                
                 KeyUp="teamMemberListBox_KeyUp"
                
                Height="Auto"
                ScrollViewer.CanContentScroll="True"
                ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                ScrollViewer.VerticalScrollBarVisibility="Hidden"/>

        <BadHabit_Factory_Controls:SmartScroll Grid.Column="0" Grid.Row="1" ScrollDirection="Up" PanelName="teamMemberListBox" RepeatButtonStyle="{StaticResource ScrollUpButton}" />
        <BadHabit_Factory_Controls:SmartScroll Grid.Column="0" Grid.Row="1" ScrollDirection="Down" PanelName="teamMemberListBox" RepeatButtonStyle="{StaticResource ScrollDownButton}" />

        <Border Grid.Column="1" Grid.RowSpan="2" Style="{StaticResource RoundBorder}" Margin="4" Width="400"
                DataContext="{Binding ElementName=teamMemberListBox, Path=SelectedItem}"
                >
            <Grid Margin="3"  >                
                <StackPanel Orientation="Vertical">
                    <BadHabit_Factory_Controls:TeamMemberDetail Grid.Row="0" Grid.ColumnSpan="2" x:Name="teamMemberDetail" ShowAuthenticationGroupBox="True"/>

                    <GroupBox Header="{x:Static props:Resources.User_Roles}" x:Name="userRolesGroupBox"
                              BadHabit_WPFTools:RoleChecker.RequiredEnableRole="FACTORY_OWNER">
                        <Grid Margin="0,5,0,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="30"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="30"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>

                            </Grid.RowDefinitions>



                            <Image Grid.Column="0" Grid.Row="0" Source="/Images/RoleType/FactoryOwner.gif" Width="24" Height="24" Stretch="Uniform" VerticalAlignment="Top"/>
                            <TextBlock Grid.Column="1" Grid.Row="0" Margin="0,0,0,10" TextWrapping="Wrap">
                            <Bold><TextBlock Text="{x:Static props:Resources.FACTORY_OWNER}"/></Bold>                                                        
                            <LineBreak/>
                            <Italic><TextBlock Text="{x:Static props:Resources.FACTORY_OWNER_tooltip}"/></Italic>
                        </TextBlock>
                            <CheckBox Grid.Column="2" Grid.Row="0" IsChecked="{Binding FactoryOwnerRole}" HorizontalAlignment="Center"/>

                            <Image Grid.Column="0" Grid.Row="1" Source="/Images/RoleType/CommercialGuy.gif" Width="24" Height="24" Stretch="Uniform" VerticalAlignment="Top"/>
                            <TextBlock Grid.Column="1" Grid.Row="1" Margin="0,0,0,10" TextWrapping="Wrap">
                            <Bold><TextBlock Text="{x:Static props:Resources.COMMERCIAL_GUY}"/></Bold>
                            <LineBreak/>
                            <Italic><TextBlock Text="{x:Static props:Resources.COMMERCIAL_GUY_tooltip}"/></Italic>
                        </TextBlock>
                            <CheckBox Grid.Column="2" Grid.Row="1" IsChecked="{Binding CommercialGuyRole}" HorizontalAlignment="Center"/>

                            <Image Grid.Column="0" Grid.Row="2" Source="/Images/RoleType/ScrumMaster.gif" Width="24" Height="24" Stretch="Uniform" VerticalAlignment="Top"/>
                            <TextBlock Grid.Column="1" Grid.Row="2" Margin="0,0,0,10" TextWrapping="Wrap">
                            <Bold><TextBlock Text="{x:Static props:Resources.SCRUM_MASTER}"/></Bold>
                            <LineBreak/>
                            <Italic><TextBlock Text="{x:Static props:Resources.SCRUM_MASTER_tooltip}"/></Italic>                            
                        </TextBlock>
                            <CheckBox Grid.Column="2" Grid.Row="2" IsChecked="{Binding ScrumMasterRole}" HorizontalAlignment="Center"/>

                            <Image Grid.Column="0" Grid.Row="3" Source="/Images/RoleType/ProductOwner.gif" Width="24" Height="24" Stretch="Uniform" VerticalAlignment="Top"/>
                            <TextBlock Grid.Column="1" Grid.Row="3" Margin="0,0,0,10" TextWrapping="Wrap">
                            <Bold><TextBlock Text="{x:Static props:Resources.PRODUCT_OWNER}"/></Bold>
                            <LineBreak/>
                            <Italic><TextBlock Text="{x:Static props:Resources.PRODUCT_OWNER_tooltip}"/></Italic>
                        </TextBlock>
                            <CheckBox Grid.Column="2" Grid.Row="3" IsChecked="{Binding ProductOwnerRole}" HorizontalAlignment="Center"/>



                            <Image Grid.Column="0" Grid.Row="4" Source="/Images/RoleType/qualityassurance.gif" Width="24" Height="24" Stretch="Uniform" VerticalAlignment="Top"/>
                            <TextBlock Grid.Column="1" Grid.Row="4" Margin="0,0,0,10" TextWrapping="Wrap">
                            <Bold><TextBlock Text="{x:Static props:Resources.QUALITY_ASSURANCE}"/></Bold>
                            <LineBreak/>
                            <Italic><TextBlock Text="{x:Static props:Resources.QUALITY_ASSURANCE_tooltip}"/></Italic>
                        </TextBlock>
                            <CheckBox Grid.Column="2" Grid.Row="4" IsChecked="{Binding QualityAssuranceRole}" HorizontalAlignment="Center"/>

                            <Image Grid.Column="0" Grid.Row="5" Source="/Images/RoleType/Team.gif" Width="24" Height="24" Stretch="Uniform" VerticalAlignment="Top"/>
                            <TextBlock Grid.Column="1" Grid.Row="5" Margin="0,0,0,10" TextWrapping="Wrap">
                            <Bold><TextBlock Text="{x:Static props:Resources.Team}"/></Bold>
                            <LineBreak/>
                            <Italic><TextBlock Text="{x:Static props:Resources.TEAM_tooltip}"/></Italic>
                        </TextBlock>
                            <CheckBox Grid.Column="2" Grid.Row="5" IsChecked="{Binding TeamRole}" HorizontalAlignment="Center"/>
                        </Grid>
                    </GroupBox>


                </StackPanel>
 

            </Grid>
            
        </Border>

    </Grid>

    
</BadHabit_WPFTools:ShapedWindow>
